package com.photography.exception;

/**
 * 自定义异常类
 * 用于业务逻辑中的异常处理
 */
public class CustomException extends RuntimeException {

    /**
     * 错误消息
     */
    private String msg;
    
    /**
     * 错误码
     */
    private String code = "-1";
    
    /**
     * 构造函数，只传入错误消息
     * 
     * @param msg 错误消息
     */
    public CustomException(String msg) {
        super(msg);
        this.msg = msg;
    }
    
    /**
     * 构造函数，传入错误消息和错误码
     * 
     * @param msg 错误消息
     * @param code 错误码
     */
    public CustomException(String msg, String code) {
        super(msg);
        this.msg = msg;
        this.code = code;
    }
    
    /**
     * 构造函数，传入错误消息和原始异常
     * 
     * @param msg 错误消息
     * @param cause 原始异常
     */
    public CustomException(String msg, Throwable cause) {
        super(msg, cause);
        this.msg = msg;
    }
    
    /**
     * 构造函数，传入全部参数
     * 
     * @param msg 错误消息
     * @param code 错误码
     * @param cause 原始异常
     */
    public CustomException(String msg, String code, Throwable cause) {
        super(msg, cause);
        this.msg = msg;
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
    
    public String getCode() {
        return code;
    }
    
    public void setCode(String code) {
        this.code = code;
    }
}
